﻿#ifndef __X2D_APPLICATION_WIN32_H__
#define __X2D_APPLICATION_WIN32_H__

#include "platform/x2common.h"
#include "platform/x2applicationprotocol.h"
#include <string>
#include <Windows.h>

NS_X2_BEGINE

class X2_DLL x2Application : public x2ApplicationProtocol
{
public:
    x2Application();
    virtual ~x2Application();

    /**
    @brief    Run the message loop.
    */
    int run();

    /**
    @brief    Get current applicaiton instance.
    @return Current application instance pointer.
    */
    static x2Application *sharedApplication();

    /* override functions */
    virtual void setAnimationInterval(double interval);

    /**
     @brief Get target platform
     */
    virtual TargetPlatform getTargetPlatform();

    /* set the Resource root path */
    void setResourceRootPath(const std::string& rootResDir);

    /* get the Resource root path */
    const std::string& getResourceRootPath(void)
    {
        return resourceRootPath;
    }

protected:
    HINSTANCE           instance;
    HACCEL              accelTable;
    LARGE_INTEGER       animationInterval;
    std::string         resourceRootPath;

    static x2Application *sharedApplication;
};

NS_X2_END

#endif // __X2D_APPLICATION_WIN32_H__